import Compressor from 'compressorjs';

export function clickAudio() {
    console.log("clickAudio....")
    let audio = document.getElementById("clickAudio");
    let audioSrc = audio.src;
    audio.src = audioSrc;
    audio.play()
}


export default function ImageCompressor(file, backType, quality) {
    return new Promise((resolve, reject) => {
        new Compressor(file, {
            quality: quality || 0.6, //压缩质量
            success(result) {
                if (!backType || backType == 'blob') {
                    resolve(result)
                } else if (backType == 'file') {
                    resolve(result)
                } else {
                    resolve(file)
                }
                // resolve(result);
            },
            error(err) {
                console.log("图片压缩失败");
                reject(err);
            }
        })
    })
}

